<script setup>
// 模拟产品数据
const products = ref([
  {
    id: 1,
    name: '智能手表 Pro',
    price: 2999,
    image: '/images/watch.jpg',
    description: '全天候健康监测，续航持久'
  },
  {
    id: 2,
    name: '无线耳机 Max',
    price: 1299,
    image: '/images/earphone.jpg',
    description: '主动降噪，HiFi音质'
  },
  {
    id: 3,
    name: '智能音箱',
    price: 699,
    image: '/images/speaker.jpg',
    description: '语音助手，智能家居控制'
  },
  {
    id: 4,
    name: '平板电脑',
    price: 3999,
    image: '/images/tablet.jpg',
    description: '高清屏幕，轻薄便携'
  }
])
</script>

<template>
  <div class="products-page">
    <div class="container">
      <h1>我们的产品</h1>
      <div class="products-grid">
        <NuxtLink 
          v-for="product in products" 
          :key="product.id"
          :to="`/products/${product.id}`"
          class="product-card"
        >
          <div class="product-image">
            <img :src="product.image" :alt="product.name" />
          </div>
          <h3>{{ product.name }}</h3>
          <p class="description">{{ product.description }}</p>
          <p class="price">¥{{ product.price }}</p>
        </NuxtLink>
      </div>
    </div>
  </div>
</template>

<style scoped>
.products-page {
  padding: 60px 20px;
  min-height: 100vh;
}

.products-page h1 {
  text-align: center;
  font-size: 42px;
  margin-bottom: 60px;
  color: #333;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  text-decoration: none;
  color: inherit;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.product-image {
  width: 100%;
  height: 220px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card h3 {
  padding: 20px 20px 10px;
  font-size: 20px;
  color: #333;
}

.description {
  padding: 0 20px;
  color: #666;
  font-size: 14px;
  margin-bottom: 15px;
}

.price {
  padding: 0 20px 20px;
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
}
</style>